﻿using System;

namespace KL.UFrame.Api.Extensions
{
    public static class DateTimeExtension
    {
        public static DateTime ToBeginning(this DateTime time)
        {
            return new DateTime(time.Year, time.Month, time.Day);
        }

        public static DateTime ToEnd(this DateTime time)
        {
            return new DateTime(time.Year, time.Month, time.Day,23,59,59);
        }

        public static DateTime ToMonthFirst(this DateTime time)
        {
            return new DateTime(time.Year, time.Month, 1);
        }

        public static DateTime ToMonthLast(this DateTime time)
        {
            return new DateTime(time.Year, time.Month, 1).AddMonths(1);
        }
    }
}